package yunjiao.javatutorials.designpatterns.interpreter;

/**
 * 结束表达式
 *
 * @author yangyunjiao
 */
public abstract class TerminalExpression implements Expression {
    protected String data;

    @Override
    public boolean interpreter(String con) {
        return con.contains(data);
    }

    @Override
    public String toString() {
        return data;
    }

    public static class StringExpression extends TerminalExpression {
        public StringExpression(String data) {
            this.data = data;
        }
    }

    public static class IntExpression extends TerminalExpression {
        public IntExpression(int data) {
            this.data = String.valueOf(data);
        }
    }
}
